package cmd

import (
	"github.com/spf13/cobra"
)


var (
	portFlag int
	pathFlag string
	filePreFlag string
)
func init() {
	// 全局的命令标识

	rootCmd.PersistentFlags().IntVarP(&portFlag, "port", "p", 8080, "服务器监听的端口")
	rootCmd.PersistentFlags().StringVar(&pathFlag, "path", "l",".", "文件监听的路径")
	rootCmd.PersistentFlags().StringVar(&filePreFlag, "prefix", "f","/file/", "文件服务器的请求地址")
}

var rootCmd = &cobra.Command{
	Use:  "server",
	Args: cobra.NoArgs
	RunE: sendCmdFunc,
}
// Execute the root command
func Execute() error {
	if err := rootCmd.Execute(); err != nil {
		return err
	}
	return nil
}
